import Taro from "@tarojs/taro";
const BaseUrl = "http://localhost:8181";
const http = ({ url, method = "get", data = {} }) => {
const token=Taro.getStorageSync('token')||''
  let p = new Promise((res, rej) => {
    Taro.request({
      url: BaseUrl + url,
      data,
      method,
      header: {
        token
      },
      success: v => {
        res(v);
      },
      fail: r => {
        rej(r);
      }
    });
  });
  return p;
};
export default http;
